package com.hjh.netty.elect.demo5.handler;

import com.hjh.netty.elect.demo5.bean.Pmc350DevPackage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;

/**
 * 心跳处理
 *
 * @author 程就人生
 * @date 2020年8月6日
 * @Description
 */
@Slf4j
public class Pmc350DevHandler111 extends ChannelInboundHandlerAdapter {

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {

        // 判断消息实例
        if (null == msg || !(msg instanceof Pmc350DevPackage)) {
            ctx.fireChannelRead(msg);
            return;
        }
        Pmc350DevPackage pmc350DevPackage = (Pmc350DevPackage) msg;
        if (pmc350DevPackage.getPackageType() != 7) {
            ctx.fireChannelRead(msg);
            return;
        }

        log.info("111：表示主站下发的请求帧，需要终端回复|{}", pmc350DevPackage);
    }
}